home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / tcppr1 / tcppro2.frm (.txt) next >
Encoding:
Visual Basic Form  |  1999-07-08  |  26.3 KB  |  766 lines

  1. VERSION 5.00
  2. Object = "{BDC217C8-ED16-11CD-956C-0000C04E4C0A}#1.1#0"; "TABCTL32.OCX"
  3. Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
  4. Object = "{3B7C8863-D78F-101B-B9B5-04021C009402}#1.2#0"; "RICHTX32.OCX"
  5. Object = "{248DD890-BB45-11CF-9ABC-0080C7E7B78D}#1.0#0"; "MSWINSCK.OCX"
  6. Object = "{48E59290-9880-11CF-9754-00AA00C00908}#1.0#0"; "MSINET.OCX"
  7. Begin VB.Form Form1 
  8.    BorderStyle     =   1  'Fixed Single
  9.    Caption         =   "TCP Pro2"
  10.    ClientHeight    =   5610
  11.    ClientLeft      =   45
  12.    ClientTop       =   330
  13.    ClientWidth     =   7755
  14.    Icon            =   "tcppro2.frx":0000
  15.    LinkTopic       =   "Form1"
  16.    MaxButton       =   0   'False
  17.    ScaleHeight     =   5610
  18.    ScaleWidth      =   7755
  19.    StartUpPosition =   2  'CenterScreen
  20.    Begin MSWinsockLib.Winsock Winsock1 
  21.       Left            =   0
  22.       Top             =   5160
  23.       _ExtentX        =   741
  24.       _ExtentY        =   741
  25.       _Version        =   393216
  26.    End
  27.    Begin TabDlg.SSTab SSTab1 
  28.       Height          =   5415
  29.       Left            =   120
  30.       TabIndex        =   0
  31.       Top             =   120
  32.       Width           =   7575
  33.       _ExtentX        =   13361
  34.       _ExtentY        =   9551
  35.       _Version        =   393216
  36.       Style           =   1
  37.       Tabs            =   4
  38.       TabsPerRow      =   4
  39.       TabHeight       =   520
  40.       TabCaption(0)   =   "Directions"
  41.       TabPicture(0)   =   "tcppro2.frx":030A
  42.       Tab(0).ControlEnabled=   -1  'True
  43.       Tab(0).Control(0)=   "Label4"
  44.       Tab(0).Control(0).Enabled=   0   'False
  45.       Tab(0).Control(1)=   "Line1"
  46.       Tab(0).Control(1).Enabled=   0   'False
  47.       Tab(0).Control(2)=   "Label2"
  48.       Tab(0).Control(2).Enabled=   0   'False
  49.       Tab(0).Control(3)=   "Label1"
  50.       Tab(0).Control(3).Enabled=   0   'False
  51.       Tab(0).Control(4)=   "Image2"
  52.       Tab(0).Control(4).Enabled=   0   'False
  53.       Tab(0).Control(5)=   "Command5"
  54.       Tab(0).Control(5).Enabled=   0   'False
  55.       Tab(0).ControlCount=   6
  56.       TabCaption(1)   =   "TCP/IP Connection Setup"
  57.       TabPicture(1)   =   "tcppro2.frx":0326
  58.       Tab(1).ControlEnabled=   0   'False
  59.       Tab(1).Control(0)=   "Frame1"
  60.       Tab(1).Control(0).Enabled=   0   'False
  61.       Tab(1).Control(1)=   "Frame2"
  62.       Tab(1).Control(1).Enabled=   0   'False
  63.       Tab(1).Control(2)=   "Option1"
  64.       Tab(1).Control(2).Enabled=   0   'False
  65.       Tab(1).Control(3)=   "Option2"
  66.       Tab(1).Control(3).Enabled=   0   'False
  67.       Tab(1).Control(4)=   "Label5"
  68.       Tab(1).Control(4).Enabled=   0   'False
  69.       Tab(1).Control(5)=   "Label6"
  70.       Tab(1).Control(5).Enabled=   0   'False
  71.       Tab(1).Control(6)=   "lblstatus"
  72.       Tab(1).Control(6).Enabled=   0   'False
  73.       Tab(1).Control(7)=   "Image4"
  74.       Tab(1).Control(7).Enabled=   0   'False
  75.       Tab(1).ControlCount=   8
  76.       TabCaption(2)   =   "TCP Pro2 Chat"
  77.       TabPicture(2)   =   "tcppro2.frx":0342
  78.       Tab(2).ControlEnabled=   0   'False
  79.       Tab(2).Control(0)=   "Image1"
  80.       Tab(2).Control(0).Enabled=   0   'False
  81.       Tab(2).Control(1)=   "Label10"
  82.       Tab(2).Control(1).Enabled=   0   'False
  83.       Tab(2).Control(2)=   "txtCHAT"
  84.       Tab(2).Control(2).Enabled=   0   'False
  85.       Tab(2).Control(3)=   "CommonDialog1"
  86.       Tab(2).Control(3).Enabled=   0   'False
  87.       Tab(2).Control(4)=   "txtstatus"
  88.       Tab(2).Control(4).Enabled=   0   'False
  89.       Tab(2).Control(5)=   "Command3"
  90.       Tab(2).Control(5).Enabled=   0   'False
  91.       Tab(2).Control(6)=   "txtmsg"
  92.       Tab(2).Control(6).Enabled=   0   'False
  93.       Tab(2).ControlCount=   7
  94.       TabCaption(3)   =   "Options"
  95.       TabPicture(3)   =   "tcppro2.frx":035E
  96.       Tab(3).ControlEnabled=   0   'False
  97.       Tab(3).Control(0)=   "Command6"
  98.       Tab(3).Control(0).Enabled=   0   'False
  99.       Tab(3).Control(1)=   "txtlocal"
  100.       Tab(3).Control(1).Enabled=   0   'False
  101.       Tab(3).Control(2)=   "Command1"
  102.       Tab(3).Control(2).Enabled=   0   'False
  103.       Tab(3).Control(3)=   "Command2"
  104.       Tab(3).Control(3).Enabled=   0   'False
  105.       Tab(3).Control(4)=   "Command4"
  106.       Tab(3).Control(4).Enabled=   0   'False
  107.       Tab(3).Control(5)=   "txtversion"
  108.       Tab(3).Control(5).Enabled=   0   'False
  109.       Tab(3).Control(6)=   "txtcomp"
  110.       Tab(3).Control(6).Enabled=   0   'False
  111.       Tab(3).Control(7)=   "Inet1"
  112.       Tab(3).Control(7).Enabled=   0   'False
  113.       Tab(3).Control(8)=   "Label13"
  114.       Tab(3).Control(8).Enabled=   0   'False
  115.       Tab(3).Control(9)=   "Label12"
  116.       Tab(3).Control(9).Enabled=   0   'False
  117.       Tab(3).Control(10)=   "Label11"
  118.       Tab(3).Control(10).Enabled=   0   'False
  119.       Tab(3).Control(11)=   "Image5"
  120.       Tab(3).Control(11).Enabled=   0   'False
  121.       Tab(3).ControlCount=   12
  122.       Begin VB.CommandButton Command6 
  123.          Caption         =   "< Back to chat"
  124.          Height          =   375
  125.          Left            =   -74880
  126.          TabIndex        =   31
  127.          Top             =   4860
  128.          Width           =   1455
  129.       End
  130.       Begin VB.TextBox txtlocal 
  131.          BackColor       =   &H80000000&
  132.          Height          =   3255
  133.          Left            =   -74880
  134.          Locked          =   -1  'True
  135.          MultiLine       =   -1  'True
  136.          ScrollBars      =   2  'Vertical
  137.          TabIndex        =   30
  138.          Top             =   1500
  139.          Width           =   7335
  140.       End
  141.       Begin VB.CommandButton Command1 
  142.          Caption         =   "Close Current Connection"
  143.          Height          =   375
  144.          Left            =   -69720
  145.          TabIndex        =   29
  146.          Top             =   4860
  147.          Width           =   2175
  148.       End
  149.       Begin VB.CommandButton Command2 
  150.          Caption         =   "Save Chat"
  151.          Height          =   375
  152.          Left            =   -73320
  153.          TabIndex        =   28
  154.          Top             =   4860
  155.          Width           =   1335
  156.       End
  157.       Begin VB.CommandButton Command4 
  158.          Caption         =   "Check for new version"
  159.          Height          =   375
  160.          Left            =   -71880
  161.          TabIndex        =   27
  162.          Top             =   4860
  163.          Width           =   2055
  164.       End
  165.       Begin VB.TextBox txtversion 
  166.          Height          =   285
  167.          Left            =   -71640
  168.          Locked          =   -1  'True
  169.          TabIndex        =   26
  170.          Top             =   900
  171.          Width           =   2775
  172.       End
  173.       Begin VB.TextBox txtcomp 
  174.          Height          =   285
  175.          Left            =   -71640
  176.          MaxLength       =   20
  177.          TabIndex        =   25
  178.          Text            =   "Friend"
  179.          Top             =   540
  180.          Width           =   2775
  181.       End
  182.       Begin VB.Frame Frame1 
  183.          Caption         =   "Server:"
  184.          Height          =   3015
  185.          Left            =   -74880
  186.          TabIndex        =   14
  187.          Top             =   1260
  188.          Width           =   3615
  189.          Begin VB.TextBox txtserverport 
  190.             Height          =   285
  191.             Left            =   1320
  192.             TabIndex        =   16
  193.             Text            =   "5001"
  194.             Top             =   360
  195.             Width           =   2175
  196.          End
  197.          Begin VB.CommandButton cmdlisten 
  198.             Caption         =   "&Listen"
  199.             Height          =   375
  200.             Left            =   840
  201.             TabIndex        =   15
  202.             Top             =   1560
  203.             Width           =   1935
  204.          End
  205.          Begin VB.Label Label7 
  206.             Caption         =   "Port to listen on:"
  207.             Height          =   255
  208.             Left            =   120
  209.             TabIndex        =   17
  210.             Top             =   360
  211.             Width           =   1215
  212.          End
  213.       End
  214.       Begin VB.Frame Frame2 
  215.          Caption         =   "Client:"
  216.          Enabled         =   0   'False
  217.          Height          =   3015
  218.          Left            =   -71160
  219.          TabIndex        =   8
  220.          Top             =   1260
  221.          Width           =   3615
  222.          Begin VB.TextBox txtserverip 
  223.             Height          =   285
  224.             Left            =   1440
  225.             TabIndex        =   11
  226.             Top             =   360
  227.             Width           =   2055
  228.          End
  229.          Begin VB.TextBox txtclientport 
  230.             Height          =   285
  231.             Left            =   1440
  232.             TabIndex        =   10
  233.             Text            =   "5001"
  234.             Top             =   840
  235.             Width           =   2055
  236.          End
  237.          Begin VB.CommandButton cmdconnect 
  238.             Caption         =   "&Connect"
  239.             Height          =   375
  240.             Left            =   840
  241.             TabIndex        =   9
  242.             Top             =   1560
  243.             Width           =   1935
  244.          End
  245.          Begin VB.Label Label8 
  246.             Caption         =   "Server IP address:"
  247.             Height          =   255
  248.             Left            =   120
  249.             TabIndex        =   13
  250.             Top             =   360
  251.             Width           =   1335
  252.          End
  253.          Begin VB.Label Label9 
  254.             Caption         =   "Port to connect to:"
  255.             Height          =   255
  256.             Left            =   120
  257.             TabIndex        =   12
  258.             Top             =   840
  259.             Width           =   1335
  260.          End
  261.       End
  262.       Begin VB.OptionButton Option1 
  263.          Caption         =   "Server"
  264.          Height          =   255
  265.          Left            =   -70920
  266.          TabIndex        =   7
  267.          Top             =   900
  268.          Value           =   -1  'True
  269.          Width           =   855
  270.       End
  271.       Begin VB.OptionButton Option2 
  272.          Caption         =   "Client"
  273.          Height          =   255
  274.          Left            =   -69960
  275.          TabIndex        =   6
  276.          Top             =   900
  277.          Width           =   735
  278.       End
  279.       Begin VB.TextBox txtmsg 
  280.          Height          =   285
  281.          Left            =   -73440
  282.          TabIndex        =   5
  283.          Top             =   660
  284.          Width           =   4935
  285.       End
  286.       Begin VB.CommandButton Command3 
  287.          Caption         =   "&Send"
  288.          Default         =   -1  'True
  289.          Height          =   405
  290.          Left            =   -68400
  291.          TabIndex        =   4
  292.          Top             =   600
  293.          Width           =   855
  294.       End
  295.       Begin VB.TextBox txtstatus 
  296.          BackColor       =   &H80000004&
  297.          Height          =   590
  298.          Left            =   -74880
  299.          Locked          =   -1  'True
  300.          MultiLine       =   -1  'True
  301.          ScrollBars      =   2  'Vertical
  302.          TabIndex        =   2
  303.          Top             =   4695
  304.          Width           =   7335
  305.       End
  306.       Begin VB.CommandButton Command5 
  307.          Caption         =   "Click to start"
  308.          Height          =   375
  309.          Left            =   2640
  310.          TabIndex        =   1
  311.          Top             =   2940
  312.          Width           =   2175
  313.       End
  314.       Begin MSComDlg.CommonDialog CommonDialog1 
  315.          Left            =   -74760
  316.          Top             =   4140
  317.          _ExtentX        =   847
  318.          _ExtentY        =   847
  319.          _Version        =   393216
  320.       End
  321.       Begin RichTextLib.RichTextBox txtCHAT 
  322.          Height          =   3495
  323.          Left            =   -74880
  324.          TabIndex        =   3
  325.          Top             =   1140
  326.          Width           =   7335
  327.          _ExtentX        =   12938
  328.          _ExtentY        =   6165
  329.          _Version        =   393217
  330.          ReadOnly        =   -1  'True
  331.          ScrollBars      =   2
  332.          TextRTF         =   $"tcppro2.frx":037A
  333.       End
  334.       Begin InetCtlsObjects.Inet Inet1 
  335.          Left            =   -68400
  336.          Top             =   660
  337.          _ExtentX        =   1005
  338.          _ExtentY        =   1005
  339.          _Version        =   393216
  340.       End
  341.       Begin VB.Label Label13 
  342.          Caption         =   "What is my..."
  343.          Height          =   255
  344.          Left            =   -74880
  345.          TabIndex        =   34
  346.          Top             =   1260
  347.          Width           =   975
  348.       End
  349.       Begin VB.Label Label12 
  350.          Caption         =   "TCP Pro current version:"
  351.          Height          =   255
  352.          Left            =   -74160
  353.          TabIndex        =   33
  354.          Top             =   900
  355.          Width           =   1935
  356.       End
  357.       Begin VB.Label Label11 
  358.          Caption         =   "The other computer is known as:"
  359.          Height          =   255
  360.          Left            =   -74160
  361.          TabIndex        =   32
  362.          Top             =   540
  363.          Width           =   2415
  364.       End
  365.       Begin VB.Image Image5 
  366.          BorderStyle     =   1  'Fixed Single
  367.          Height          =   540
  368.          Left            =   -74760
  369.          Picture         =   "tcppro2.frx":044F
  370.          Top             =   540
  371.          Width           =   540
  372.       End
  373.       Begin VB.Image Image2 
  374.          BorderStyle     =   1  'Fixed Single
  375.          Height          =   540
  376.          Left            =   240
  377.          Picture         =   "tcppro2.frx":0759
  378.          Top             =   540
  379.          Width           =   540
  380.       End
  381.       Begin VB.Label Label1 
  382.          Caption         =   $"tcppro2.frx":0A63
  383.          Height          =   615
  384.          Left            =   840
  385.          TabIndex        =   24
  386.          Top             =   540
  387.          Width           =   6615
  388.       End
  389.       Begin VB.Label Label2 
  390.          Caption         =   $"tcppro2.frx":0B4D
  391.          Height          =   855
  392.          Left            =   240
  393.          TabIndex        =   23
  394.          Top             =   1140
  395.          Width           =   7215
  396.       End
  397.       Begin VB.Line Line1 
  398.          X1              =   120
  399.          X2              =   7440
  400.          Y1              =   4680
  401.          Y2              =   4680
  402.       End
  403.       Begin VB.Label Label4 
  404.          Caption         =   $"tcppro2.frx":0CF1
  405.          Height          =   495
  406.          Left            =   120
  407.          TabIndex        =   22
  408.          Top             =   4800
  409.          Width           =   7335
  410.       End
  411.       Begin VB.Label Label5 
  412.          Caption         =   "Please enter the appropriate information below:"
  413.          Height          =   255
  414.          Left            =   -74160
  415.          TabIndex        =   21
  416.          Top             =   600
  417.          Width           =   6615
  418.       End
  419.       Begin VB.Label Label6 
  420.          Caption         =   "Are you going to be the server or the client?"
  421.          Height          =   255
  422.          Left            =   -74160
  423.          TabIndex        =   20
  424.          Top             =   900
  425.          Width           =   3135
  426.       End
  427.       Begin VB.Label lblstatus 
  428.          BorderStyle     =   1  'Fixed Single
  429.          Caption         =   $"tcppro2.frx":0DA5
  430.          Height          =   855
  431.          Left            =   -74880
  432.          TabIndex        =   19
  433.          Top             =   4380
  434.          Width           =   7335
  435.       End
  436.       Begin VB.Label Label10 
  437.          Caption         =   "Message:"
  438.          Height          =   255
  439.          Left            =   -74160
  440.          TabIndex        =   18
  441.          Top             =   660
  442.          Width           =   735
  443.       End
  444.       Begin VB.Image Image4 
  445.          BorderStyle     =   1  'Fixed Single
  446.          Height          =   540
  447.          Left            =   -74760
  448.          Picture         =   "tcppro2.frx":0E6B
  449.          Top             =   540
  450.          Width           =   540
  451.       End
  452.       Begin VB.Image Image1 
  453.          BorderStyle     =   1  'Fixed Single
  454.          Height          =   540
  455.          Left            =   -74760
  456.          Picture         =   "tcppro2.frx":1175
  457.          Top             =   540
  458.          Width           =   540
  459.       End
  460.    End
  461. Attribute VB_Name = "Form1"
  462. Attribute VB_GlobalNameSpace = False
  463. Attribute VB_Creatable = False
  464. Attribute VB_PredeclaredId = True
  465. Attribute VB_Exposed = False
  466. Private Sub cmd1_Click()
  467. Winsock3.LocalPort = txt1.Text
  468. Winsock3.Listen
  469. Frame3.Visible = False
  470. t1.Visible = True
  471. t2.Visible = True
  472. t3.Visible = True
  473. t4.Visible = True
  474. t5.Visible = True
  475. t6.Visible = True
  476. t7.Visible = True
  477. t8.Visible = True
  478. t9.Visible = True
  479. t10.Visible = True
  480. t11.Visible = True
  481. t12.Visible = True
  482. t13.Visible = True
  483. t14.Visible = True
  484. End Sub
  485. Private Sub cmd2_Click()
  486. Winsock3.RemoteHost = txt2.Text
  487. Winsock3.RemotePort = txt3.Text
  488. Winsock3.Connect
  489. Frame3.Visible = False
  490. t1.Visible = True
  491. t2.Visible = True
  492. t3.Visible = True
  493. t4.Visible = True
  494. t5.Visible = True
  495. t6.Visible = True
  496. t7.Visible = True
  497. t8.Visible = True
  498. t9.Visible = True
  499. t10.Visible = True
  500. t11.Visible = True
  501. t12.Visible = True
  502. t13.Visible = True
  503. t14.Visible = True
  504. End Sub
  505. Private Sub Command1_Click()
  506. On Error GoTo err:
  507. Winsock1.SendData "Other user disconnected!"
  508. Winsock1.Close
  509. Frame1.Enabled = True
  510. Frame2.Enabled = True
  511. Option1.Enabled = True
  512. Option2.Enabled = True
  513. SSTab1.Tab = 0
  514. Exit Sub
  515. txtstatus.Text = txtstatus.Text & err.Description & " - Error number: " & err.Number & vbCrLf
  516. txtstatus.SelStart = Len(txtstatus.Text)
  517. End Sub
  518. Private Sub cmdconnect_Click()
  519. On Error GoTo err:
  520. Winsock1.RemoteHost = txtserverip.Text
  521. Winsock1.RemotePort = txtclientport.Text
  522. Winsock1.Connect
  523. SSTab1.Tab = 2
  524. txtmsg.SetFocus
  525. Frame1.Enabled = False
  526. Frame2.Enabled = False
  527. Option1.Enabled = False
  528. Option2.Enabled = False
  529. Exit Sub
  530. txtstatus.Text = txtstatus.Text & err.Description & " - Error number: " & err.Number & vbCrLf
  531. txtstatus.SelStart = Len(txtstatus.Text)
  532. End Sub
  533. Private Sub cmdlisten_Click()
  534. On Error GoTo err:
  535. Winsock1.LocalPort = txtserverport.Text
  536. Winsock1.Listen
  537. SSTab1.Tab = 2
  538. txtmsg.SetFocus
  539. Frame1.Enabled = False
  540. Frame2.Enabled = False
  541. Option1.Enabled = False
  542. Option2.Enabled = False
  543. Exit Sub
  544. txtstatus.Text = txtstatus.Text & err.Description & " - Error number: " & err.Number & vbCrLf
  545. txtstatus.SelStart = Len(txtstatus.Text)
  546. End Sub
  547. Private Sub Command16_Click()
  548. End Sub
  549. Private Sub Command2_Click()
  550. If txtCHAT.Text <> "" Then
  551.     CommonDialog1.Filter = "Text files (*.txt)|*.txt"
  552.     CommonDialog1.ShowSave
  553.         If CommonDialog1.FileName <> "" Then
  554.             Open CommonDialog1.FileName For Output As #1
  555.             Print #1, txtCHAT.Text
  556.             Close #1
  557.         End If
  558. End If
  559. End Sub
  560. Private Sub Command3_Click()
  561. If txtmsg.Text <> "" Then
  562.     On Error GoTo err:
  563.     Winsock1.SendData txtmsg.Text
  564.     txtCHAT.Text = txtCHAT.Text & "Me: " & txtmsg.Text & vbCrLf
  565.     txtmsg.Text = ""
  566.     txtCHAT.SelStart = Len(txtCHAT.Text)
  567. End If
  568. Exit Sub
  569.     txtstatus.Text = txtstatus.Text & err.Description & " - Error number: " & err.Number & vbCrLf
  570.     txtstatus.SelStart = Len(txtstatus.Text)
  571. End Sub
  572. Private Sub Command4_Click()
  573. On Error GoTo err:
  574. If Inet1.OpenURL("http://www.nowresources.com/directchat/version.txt") > App.Major & App.Minor & App.Revision Then
  575.     Dim prompt As String
  576.     Dim reply As Integer
  577.     prompt = MsgBox("There is an upgrade to a new version available on the NOW Resources server.", vbExclamation)
  578.     MsgBox "Do you want to download it now?", vbYesNo, "Download now?"
  579.     If reply = vbNo Then
  580.     Exit Sub
  581.     Else
  582.     'get download from server...
  583.     'start download
  584.     Dim strURL As String
  585.     Dim bData() As Byte      ' Data variable
  586.     Dim intFile As Integer   ' FreeFile variable
  587.     strURL = _
  588.     "www.nowresources.com/danoph/setup.zip"
  589.     intFile = FreeFile()      ' Set intFile to an unused
  590.                             ' file.
  591.     ' The result of the OpenURL method goes into the Byte
  592.     ' array, and the Byte array is then saved to disk.
  593.     bData() = Inet1.OpenURL(strURL, icByteArray)
  594.     Open App.Path & "setup.zip" For Binary Access Write _
  595.     As #intFile
  596.     Put #intFile, , bData()
  597.     Close #intFile
  598.     End If
  599. MsgBox "There are no upgrades to your current version.", vbExclamation
  600. End If
  601. End Sub
  602. Private Sub Command5_Click()
  603. SSTab1.Tab = 1
  604. Option1.Value = True
  605. Option2.Value = False
  606. On Error GoTo err:
  607. txtserverport.SetFocus
  608. txtserverport.SelStart = 0
  609. txtserverport.SelLength = Len(txtserverport.Text)
  610. End Sub
  611. Private Sub Command6_Click()
  612. SSTab1.Tab = 2
  613. txtmsg.SetFocus
  614. End Sub
  615. Private Sub Command7_Click()
  616. End Sub
  617. Private Sub Form_Load()
  618. txtversion.Text = App.Major & "." & App.Minor & "." & App.Revision
  619. txtlocal.Text = "Local Host Name (networking name): " & Winsock1.LocalHostName _
  620. & vbCrLf & "Local IP Address: " & Winsock1.LocalIP & vbCrLf _
  621. & "Local Port: " & Winsock1.LocalPort & vbCrLf _
  622. & vbCrLf & "---------What is---------" & vbCrLf & vbCrLf _
  623. & "An IP address?" & vbCrLf & "An IP address is the address you use when you are online; your computer's online address.  Other computers " _
  624. & "can talk to you using this IP address.  Your LOCAL IP address is listed above, but you need to check your internet connection settings in your ISP's dialer for your IP address." _
  625. & vbCrLf & vbCrLf & "A Port?" & vbCrLf & "A port is space in your computer reserved for connecting to other computers.  Most computers have 5000+ ports on their computer.  For example, TCP Pro asks the server for the port to 'listen' on, and you have to connect to that port so you can chat using TCP Pro." & vbCrLf & vbCrLf & "TCP Pro2 Copyright 
  626.  1999 Daniel Errante.  All rights reserved.  Any questions or comments should be sent to danoph@hotmail.com and will get a response within 48 hours."
  627. CommonDialog1.FileName = App.Path & "\knownas.txt"
  628. On Error GoTo toobig:
  629.         Open CommonDialog1.FileName For Input As #1
  630.         On Error GoTo toobig:    'set error handler
  631.         Do Until EOF(1)          'then read lines from file
  632.             Line Input #1, LineOfText$
  633.             alltext$ = alltext$ & LineOfText$
  634.         Loop
  635.         txtcomp.Text = alltext$  'display file
  636.         Close #1                 'close file
  637. If Winsock1.State <> sckClosed Then
  638. On Error GoTo err:
  639. Winsock1.SendData "Other user connected!"
  640. Winsock1.Close
  641. End If
  642. Exit Sub
  643. txtstatus.Text = txtstatus.Text & err.Description & " - Error number: " & err.Number & vbCrLf
  644. txtstatus.SelStart = Len(txtstatus.Text)
  645. toobig:
  646. End Sub
  647. Private Sub Form_Unload(Cancel As Integer)
  648. If Winsock1.State <> sckClosed Then
  649. On Error GoTo err:
  650. Winsock1.SendData "Other user disconnected!"
  651. Winsock1.Close
  652. End If
  653. Exit Sub
  654. txtstatus.Text = txtstatus.Text & err.Description & " - Error number: " & err.Number & vbCrLf
  655. txtstatus.SelStart = Len(txtstatus.Text)
  656. End Sub
  657. Private Sub Option1_Click()
  658. Frame1.Enabled = True
  659. Frame2.Enabled = False
  660. lblstatus.Caption = "After you type in the port you will listen on, click listen to listen for users to connect.  Then click on the tab TCP Pro Chat to chat when the other user connects."
  661. txtserverport.SetFocus
  662. txtserverport.SelStart = 0
  663. txtserverport.SelLength = Len(txtserverport.Text)
  664. End Sub
  665. Private Sub Option2_Click()
  666. Frame2.Enabled = True
  667. Frame1.Enabled = False
  668. lblstatus.Caption = "After you type in the server IP address and the port you will connect to, click connect to connect to the server that is listening for you to connect.  NOTE:  There must be a server listening for clients to connect first or TCP connection will not work!"
  669. txtserverip.SetFocus
  670. End Sub
  671. Private Sub Option3_Click()
  672. Option4.Value = False
  673. lbl1.Enabled = True
  674. lbl2.Enabled = True
  675. txt1.Enabled = True
  676. cmd1.Enabled = True
  677. lbl3.Enabled = False
  678. lbl4.Enabled = False
  679. lbl5.Enabled = False
  680. txt2.Enabled = False
  681. txt3.Enabled = False
  682. cmd2.Enabled = False
  683. End Sub
  684. Private Sub Option4_Click()
  685. Option3.Value = False
  686. lbl3.Enabled = True
  687. lbl4.Enabled = True
  688. lbl5.Enabled = True
  689. txt2.Enabled = True
  690. txt3.Enabled = True
  691. cmd2.Enabled = True
  692. lbl1.Enabled = False
  693. lbl2.Enabled = False
  694. txt1.Enabled = False
  695. cmd1.Enabled = False
  696. End Sub
  697. Private Sub Text1_Click()
  698. text1.SelStart = 0
  699. text1.SelLength = Len(text1.Text)
  700. End Sub
  701. Private Sub Text3_Click()
  702. Text3.SelStart = 0
  703. Text3.SelLength = Len(Text3.Text)
  704. End Sub
  705. Private Sub txtclientport_Click()
  706. With txtclientport
  707. .SelStart = 0
  708. .SelLength = Len(.Text)
  709. End With
  710. End Sub
  711. Private Sub txtcomp_Change()
  712. If txtcomp.Text <> "" Then
  713.     CommonDialog1.FileName = App.Path & "\knownas.txt"
  714.     On Error GoTo err:
  715.     Open CommonDialog1.FileName For Output As #1
  716.     Print #1, txtcomp.Text
  717.     Close #1
  718. End If
  719. Exit Sub
  720. End Sub
  721. Private Sub txtcomp_Click()
  722. txtcomp.SelStart = 0
  723. txtcomp.SelLength = Len(txtcomp.Text)
  724. End Sub
  725. Private Sub txtcomp_DblClick()
  726. txtcomp.SelStart = Len(txtcomp.Text)
  727. End Sub
  728. Private Sub txtversion_Click()
  729. txtversion.SelStart = 0
  730. txtversion.SelLength = Len(txtversion.Text)
  731. End Sub
  732. Private Sub Winsock1_Close()
  733. MsgBox "Connection Closed.", vbExclamation
  734. End Sub
  735. Private Sub Winsock1_Connect()
  736. On Error GoTo err:
  737. MsgBox "User Connected!", vbExclamation
  738. Winsock1.SendData "Other user connected!"
  739. Exit Sub
  740. txtstatus.Text = txtstatus.Text & err.Description & " - Error number: " & err.Number & vbCrLf
  741. txtstatus.SelStart = Len(txtstatus.Text)
  742. End Sub
  743. Private Sub Winsock1_ConnectionRequest(ByVal requestID As Long)
  744. On Error GoTo err:
  745. If Winsock1.State <> sckClosed Then Winsock1.Close
  746. Winsock1.Accept requestID
  747. Exit Sub
  748. txtstatus.Text = txtstatus.Text & err.Description & " - Error number: " & err.Number & vbCrLf
  749. txtstatus.SelStart = Len(txtstatus.Text)
  750. End Sub
  751. Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
  752. If Me.WindowState = 1 Then Me.WindowState = 0
  753. Dim strdata As String
  754. On Error GoTo err:
  755. Winsock1.GetData strdata
  756. txtCHAT.Text = txtCHAT.Text & txtcomp.Text & ": " & strdata & vbCrLf
  757. txtCHAT.SelStart = Len(txtCHAT.Text)
  758. Exit Sub
  759. txtstatus.Text = txtstatus.Text & err.Description & " - Error number: " & err.Number & vbCrLf
  760. txtstatus.SelStart = Len(txtstatus.Text)
  761. End Sub
  762. Private Sub Winsock1_Error(ByVal Number As Integer, Description As String, ByVal Scode As Long, ByVal Source As String, ByVal HelpFile As String, ByVal HelpContext As Long, CancelDisplay As Boolean)
  763. txtstatus.Text = txtstatus.Text & err.Description & " - Error number: " & err.Number & vbCrLf
  764. txtstatus.SelStart = Len(txtstatus.Text)
  765. End Sub
  766.